<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
    String ctx = request.getContextPath();    //콘텍스트명 얻어오기.
%>
<html>
<link rel="stylesheet" type="text/css" href="../css/reset.css" />
<link rel="stylesheet" type="text/css" href="../css/common.css" />
<link rel="stylesheet" type="text/css" href="../css/index.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>익명게시판 글쓰기</title>
<!-- 탑 인클루드 -->
<jsp:include page="/main/header.jsp"></jsp:include>
<script type="text/javascript" src="../smarteditor/js/HuskyEZCreator.js" charset="utf-8"></script>
<script type="text/javascript">
function submitContents(btn) {
    // 에디터의 내용이 textarea에 적용된다.
    oEditors.getById["CONTENT"].exec("UPDATE_CONTENTS_FIELD", []);
 
    // 에디터의 내용에 대한 값 검증은 이곳에서
    // document.getElementById("ir1").value를 이용해서 처리한다.
 
    try {
        NullCheck();
    } catch(e) {}
}

function NullCheck(){
	var form = document.notice;
	
	if(form.TITLE.value==''){
		alert("제목을 입력하세요");
		form.TEAMNAME.focus();
	}
	else if(form.CONTENT.value=="<p>&nbsp;</p>"){
		alert("내용을 입력하세요");
		form.NAME.focus();
	}
	else form.submit();
}
</script>
<body>
<%
 java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd"); // 오늘 날짜
 String today = formatter.format(new java.util.Date());
 
 String userID = "사용자";
%>
<br><br><br><br><br><br><br><br><br>
<div class="wrap">
	<h1>글 입력</h1>
	<div class="table">
		<form name="notice" method="post" action="./AboardInsertDB.go">
			<div class="textinput">
				<label for="title">제목 : </label>
				<input TYPE="text" NAME="TITLE" ID="TITLE" style="height: 30px; width: 500px; background-color: transparent; border: 0px;"></div>
			
			<div class="textinput">
				<label for="title">글쓴이 : <%= userID %></label></div>
			<div class="textinput">
			
				<label for="date">날짜 : <%= today %></label></div>		
				<textarea name="CONTENT" id="CONTENT" rows="10" cols="100" style="width: 1000px"></textarea>
			<input TYPE="button" value="등록" onclick="submitContents();" style="width: 1000px">
			
			<input TYPE="hidden" value="<%= userID%>" NAME="REG_ID" ID="REG_ID">
			<input TYPE="hidden" value=<%= today %> NAME="REG_DTM" ID="REG_DTM">
		</form>
	</div>	
</div>			

<script type="text/javascript">
var oEditors = [];
nhn.husky.EZCreator.createInIFrame({
 oAppRef: oEditors,
 elPlaceHolder: "CONTENT",
 sSkinURI: "../smarteditor/SmartEditor2Skin.html",
 fCreator: "createSEditor2"
 });
</script> 
</body>
</html>